package net.homelinux.chaoswg.io.renga.krypto.operations.vector;

import net.homelinux.chaoswg.io.higherorderfunctions.AbstractUnaryFunction;
import net.homelinux.chaoswg.io.higherorderfunctions.UnaryFunction;
import net.homelinux.chaoswg.io.renga.krypto.datatypes.vectors.BitVector;

public class RightShift extends AbstractUnaryFunction<BitVector, BitVector> implements UnaryFunction<BitVector, BitVector> {
    public final BitVector apply (final BitVector b0) {
        final BitVector toReturn = new BitVector(b0.getSize());

        for (int i = b0.getSize () - 1; i > 0; --i) {
            toReturn.set(i, b0.get(i-1));
        }
        toReturn.set(0, false);

        return toReturn;
    }

    public String toString () {
        return "Right Shift";
    }
}
